package com.taihe.controller;

import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.xerces.internal.dom.PSVIAttrNSImpl;
import com.taihe.config.JmsConfig;
import com.taihe.config.MyProperties;
import com.taihe.jms.Producer;
import com.taihe.redis.Redis;
import com.taihe.service.TsPlatformUserService;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import static org.apache.coyote.http11.Constants.a;


/**
 * Created by zwt on 2018/7/20.
 */
@Controller
public class TestController {

    @Autowired
    private Environment environment;

    @Autowired
    private MyProperties myProperties;

    @Autowired
    private Producer producer;


    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @Autowired
    private Redis redis;

    @Autowired
    private TsPlatformUserService tsPlatformUserService;

    private Logger logger = LoggerFactory.getLogger(TestController.class);

    //这种方式只能读取写到application.properties中的

    @RequestMapping("test")
    @ResponseBody
    public String test(){
       /* String w = environment.getProperty("test.name");
        //如果没有写到application.propertiies中的 只能通过下面的方式获取
        String imageUrl = myProperties.getImageUrl();
        String name = myProperties.getName();
        System.out.println(12);*/
        producer.sendMessage("test","点对点消息");
        return "1111";
    }


    public static void main(String[] args) {
        List<Integer> integers = new ArrayList<>(5);
        integers.add(1);
        integers.add(2);
        integers.add(4);
        integers.add(5);
        for(int i=0; i<integers.size();i++){
           if(integers.get(i)==1){
               integers.remove(i);
           }
        }
        System.out.println(integers);
    }








}
